import js from '@eslint/js'
import prettier from 'eslint-plugin-prettier'
import importSort from 'eslint-plugin-simple-import-sort'
import globals from 'globals'
import tsEslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
    globalIgnores(['.husky/*', '.cspell/*']),
    {
        files: ['packages/**/src/**/*.{js,jsx,ts,tsx}', 'apps/**/src/**/*.{js,jsx,ts,tsx}'],
        plugins: {
            'simple-import-sort': importSort,
            prettier: prettier
        },
        extends: [js.configs.recommended, ...tsEslint.configs.recommended],
        languageOptions: {
            parser: tsEslint.parser,
            globals: {
                ...globals.browser,
                ...globals.node
            }
        },
        rules: {
            'simple-import-sort/imports': 'error',
            'simple-import-sort/exports': 'error',
            'prettier/prettier': 'error',
            'no-console': 'error',
            'no-unused-vars': 'error',
            'no-var': 'error',
            'no-debugger': 'error'
        }
    }
])
